# Contributor: Will Sinatra <wpsinatra@gmail.com>
# Maintainer: Will Sinatra <wpsinatra@gmail.com>
pkgname=janet
pkgver=1.10.0
pkgrel=0
pkgdesc="Dynamic Lisp dialect and bytecode VM"
url="https://janet-lang.org/"
license="MIT"
arch="armv7 x86 x86_64 aarch64"
source="$pkgname-$pkgver.tar.gz::https://github.com/janet-lang/janet/archive/v$pkgver.tar.gz"
subpackages="$pkgname-static $pkgname-dev $pkgname-doc"
options="!check" #No defined checks

build() {
	# Linter flags the janet_build var as being undefined
	# It's filled through the make process and is necessary for janet to build
	make PREFIX=/usr $janet_build
	make PREFIX=/usr build/janet.pc
	make PREFIX=/usr docs
}

package() {
	install -Dt "$pkgdir"/usr/bin build/janet jpm
	install -Dm644 -t "$pkgdir"/usr/include/janet src/include/janet.h src/conf/janetconf.h

	install -Dm644 build/libjanet.a -t "$pkgdir"/usr/lib

	install -Dm755 build/libjanet.so "$pkgdir"/usr/lib/libjanet.so.$pkgver
	ln -s libjanet.so.$pkgver "$pkgdir"/usr/lib/libjanet.so
	ln -s libjanet.so.$pkgver "$pkgdir"/usr/lib/libjanet.${pkgver%.*.*}

	install -Dm644 build/janet.pc -t "$pkgdir"/usr/lib/pkgconfig

	install -Dm644 -t "$pkgdir"/usr/share/man janet.1 jpm.1

	install -dm755 "$pkgdir"/usr/share/janet
	cp -a examples "$pkgdir"/usr/share/janet

	install -Dm644 build/doc.html "$pkgdir"/usr/share/doc/janet/doc.html
	install -Dm644 -t "$pkgdir"/usr/lib/janet tools/.keep
}

sha512sums="aa6a81b4d53022fa151d01c32bccf54c8bfbf6985b99152406cd3e259e930692a7562212007cec91edac9e34e9a9f5b7d46b8b6827a001e54edf37e70f788015  janet-1.10.0.tar.gz"
